<meta charset="UTF-8">

<!-- <a href="javascript:toPage(3)">首页</a>
<a href="javascript:toPage(1)">上一页</a>
<a href="javascript:toPage(2)">下一页</a>
<a href="javascript:toPage(4)">尾页</a> -->
<ul class="pagination">
    <li><a href="javascript:toPage(1)">&laquo;</a></li>
    <li><a href="javascript:toPage(3)">首页</a></li>
    <li><a href="javascript:toPage(4)">尾页</a></li>
    <li><a href="javascript:toPage(2)">&raquo;</a></li>
</ul>

当前第<input type="text" id="pageNumber" name="pageNum" size="1">页
每页<input type="text" id="pageSize" name="pageSize" size="1">条
共<input type="text" id="totalPage" name="totalPage" readonly="readonly" size="1">页
共<input type="text" id="totalCount" name="totalCount" readonly="readonly" size="1">条

<script type="text/javascript">
    function pageInstall(page){
        //获取页面文本框并赋值 (当前页数)
        $("#pageNumber").val(page.pageNum);
        $("#pageSize").val(page.pageSize);
        $("#totalPage").val(page.pages);
        $("#totalCount").val(page.total);
    }

    function toPage(flag){
        var pageNumber = parseInt($("#pageNumber").val());
        var totalPage = parseInt($("#totalPage").val());
        if(flag == 1){
            if(pageNumber <= 1){//上一页
                alert("已经是首页");
                return;
            }
            $("#pageNumber").val(pageNumber - 1);
        }else if(flag == 2){//下一页
            if(pageNumber >= totalPage){
                alert("已经是尾页");
                return;
            }
            $("#pageNumber").val(pageNumber + 1);
        }else if(flag == 3){//首页
            if(pageNumber <= 1){
                alert("已经是首页");
                return;
            }
            $("#pageNumber").val(1);
        }else if(flag == 4){//尾页
            if(pageNumber >= totalPage){
                alert("已经是尾页");
                return;
            }
            $("#pageNumber").val(totalPage);
        }
        getData();
    }


</script>
